package com.imti.webdemo;

import android.content.Context;
import android.webkit.JavascriptInterface;
import android.widget.Toast;

public class JSInterface
{

    private Context mContext;

    public JSInterface(Context context)
    {
        this.mContext = context;
    }

    //提供给JavaScript访问的方法，必须添加@JavascriptInterface注解
    @JavascriptInterface
    public void showToast(String msg)
    {
        Toast.makeText(mContext, msg, Toast.LENGTH_SHORT).show();
    }
}
